package com.barneyx.mshinfoplatform.entity.info.article;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.barneyx.mshinfoplatform.entity.AreaCommonEntity;
import com.barneyx.mshinfoplatform.entity.enums.EInfoState;
import com.barneyx.mshinfoplatform.entity.enums.EPlatformType;
import com.barneyx.mshinfoplatform.entity.enums.ETemplateType;
import com.barneyx.mshinfoplatform.entity.user.UserEntity;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableCharset;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableEngine;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlCharsetConstant;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlEngineConstant;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "msh_article_list", autoResultMap = true)
@TableCharset(MySqlCharsetConstant.UTF8MB4)
@TableEngine(value = MySqlEngineConstant.MyISAM)
public class ArticleEntity extends AreaCommonEntity {
    @TableId(value = "article_id", type = IdType.ASSIGN_ID)
    @Column(type = MySqlTypeConstant.BIGINT)
    private String ArticleId;


    @TableField("article_title")
    @Column(type = MySqlTypeConstant.VARCHAR, length = 30)
    private String ArticleTitle;

    @TableField("article_desc")
    @Column(type = MySqlTypeConstant.VARCHAR, length = 100)
    private String ArticleDesc;

    @TableField("article_conver")
    @Column(type = MySqlTypeConstant.CHAR)
    private String ArticleConver;


    @TableField("article_click")
    private Long ArticleClick;

    @ApiModelProperty("用户编号")
    @TableField("user_id")
    @Column(isNull = false, type = MySqlTypeConstant.BIGINT)
    @NotNull(message = "所属用户UserId不能为空")
    private String UserId;

    @ApiModelProperty("所属用户")
    @TableField(exist = false)
    private UserEntity User;


    @ApiModelProperty("所属用户平台编号")
    @TableField("user_platform_id")
    @Column(isNull = false, type = MySqlTypeConstant.BIGINT)
    @NotNull(message = "所属平台不能为空!")
    private String UserPlatformId;


    @ApiModelProperty("信息状态")
    @Column(type = MySqlTypeConstant.TINYINT, defaultValue = "1")
    private EInfoState State;


    @ApiModelProperty("信息分类")
    @TableField("article_cate_id")
    @Column(type = MySqlTypeConstant.BIGINT)
    private String CarticleCateId;


    @TableField("cate_name")
    @Column(type = MySqlTypeConstant.CHAR, length = 20)
    private String CateName;


    @TableField("article_post_name")
    private String CarticlePostName;

    @TableField("article_post_via")
    private String CarticlePostVia;


    @TableField("post_platform")
    @Column(comment = "信息是哪一个平台发布的", type = MySqlTypeConstant.TINYINT)
    @JsonDeserialize()
    private EPlatformType PlatformType;


    @TableField(exist = false)
    private ArticleAttrEntity ArticleAttr;


    @TableField("template_type")
    @Column(type = MySqlTypeConstant.TINYINT, defaultValue = "102")
    private ETemplateType TemplateType;


}
